<template>
    <div>
        <div>
            <el-carousel :interval="4000" type="" height="200px">
                <el-carousel-item v-for="(item, index) in lstBanner" :key="index">
                    <div><img style="height: 100%;width: 100%;" :src=item.imgUrl @click="imageClick(item)"></div>
                </el-carousel-item>
            </el-carousel>
        </div>
        <div class="shaicha">
            <img @click="goMessage" src="./img2/btnScreen.png" alt="">
            <div class="bottom">
                <img src="./img2/btnButtom_index1.png" alt="">
                <img @click="goReport" src="./img2/btnButtom_mine1.png" alt="">
            </div>
        </div>
    </div>
</template>
<script>

import axios from "axios";
import {
    getUrl
} from "@/config.js";

export default {
    props: {
    },
    data() {
        return {
            baseUrl: "",
            isShow: true,
            data: {},
            inputData: "",
            imgUrl: "",
            activityCount: "",
            lstBanner: [],
            sex: ''
        };
    },
    computed: {

    },
    methods: {
        imageClick(item) {
            
        },
        goMessage() {
            this.$router.push('/message')
        },
        goReport() {
            this.$router.push({
                path: '/mine',
                query: {
                    sex: this.sex
                }
            })
        },
        getData() {
            var baseUrl = getUrl();
            var token = localStorage.getItem('token')
            axios.get(
                baseUrl + "/an/wechat_app/wechat_user/info?token=" + token,
                // `https://www.ainaoxingdong.com/api/an/wechat_app/wechat_user/report/bind_img?token=${_this.token}`,
                {
                    // phone: this.phoneInfo,
                    // isSuggest: 3
                }
            ).then((res) => {
                const userInfo = res.data.rows[0];
                console.log('个人信息', userInfo);
                this.sex = userInfo.sex
                console.log('性别', this.sex);
                // this.ruleForm.userName = userInfo.userName
                // this.ruleForm.userCardId = userInfo.userCardId
                // this.ruleForm.sex = userInfo.sex
                // this.ruleForm.education = userInfo.education
                // this.ruleForm.age = userInfo.age

                // this.phone = userInfo.phone
                // console.log(phone);
                if (res.data.code == 200) {

                    // debugger
                    //   localStorage.setItem("sex", res.data.rows[0].sex);
                    // this.$router.push('/activity')
                } else {
                    // this.$message.error('信息获取失败！');
                }
            });
        },

    },
    mounted() {
        this.getData()
        this.$store.dispatch('checkUser');
        var me = this;
        this.baseUrl = getUrl();
        axios.get(
            this.baseUrl + "/system/banner/list?bannerType=0"
        ).then((res) => {
            me.lstBanner = res.data.rows;
            for (let i = 0; i < me.lstBanner.length; i++) {
                var banner = me.lstBanner[i];
                banner.imgUrl = me.baseUrl + banner.imgUrl;
            }
        });
    },
};
</script>

<style lang="scss" scoped>
* {
    margin: 0;
    padding: 0;
}

.shaicha {
    margin-top: 100px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.shaicha img {
    width: 100%;

}

.bottom {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-top: 30px;
}

.bottom img {
    width: 156px;
    height: 36px;

}

.infoClass {
    position: relative;
    font-size: medium;
    font-weight: bold;
    left: 85px;
    top: 450px;
}

.countClass {
    position: relative;
    font-size: medium;
    left: 120px;
    top: 665px;
}

.el-carousel__item h3 {
    color: #475669;
    font-size: 14px;
    opacity: 0.75;
    line-height: 200px;
    margin: 0;
}

.el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
}

.swiper-item {
    display: block;
    height: 312rpx;
    line-height: 300rpx;
    text-align: center;
}
</style>
